<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Register Page</title>
</head>
<body>
	<form action="CheckInfo.jsp" method="post">
		<h3>学生信息注册</h3>
		<table>
			<tbody>
				<tr>
					<td>姓名：</td>
					<td><input id="txt_realName" name="realName" type="text"/></td>
					<td><font color="red">*</font>&nbsp;<span id="sp_realName" style="color:red;"></span></td>
				</tr>
				<tr>
					<td>学号：</td>
					<td><input id="txt_studentNo" name="studentNo" type="text" maxlength="14" /></td>
					<td><font color="red">*</font>&nbsp;<span id="sp_studentNo" style="color:red;"></span></td>
				</tr>
				<tr>
					<td>性别：</td>
					<td>
						<input id="rd_male" name="gender" value="男" type="radio"/><label for="rd_male">男</label>
						<input id="rd_female" name="gender" value="女" type="radio"/><label for="rd_female">女</label>
					</td>
					<td></td>
				</tr>
				<tr>
					<td>学历：</td>
					<td>
						<input id="rd_undergraduate" name="educational" value="本科" type="radio"/><label for="rd_undergraduate">本科</label>
						<input id="rd_junior" name="educational" value="专科" type="radio"/><label for="rd_junior">专科</label>
					</td>
					<td></td>
				</tr>
				<tr>
					<td>个人爱好：</td>
					<td>
						<input id="cb_travel" name="hobbit" value="旅游" type="checkbox"/><label for="cb_travel">旅游</label>
						<input id="cb_paint" name="hobbit" value="绘画" type="checkbox"/><label for="cb_paint">绘画</label>
						<input id="cb_ball" name="hobbit" value="球类运动" type="checkbox"/><label for="cb_ball">球类运动</label>
						<input id="cb_music" name="hobbit" value="音乐" type="checkbox"/><label for="cb_music">音乐</label>
					</td>
					<td></td>
				</tr>
				<tr>
					<td>所学专业：</td>
					<td>
						<select id="slt_special" name="special">
							<option value=""></option>
							<option value="工商管理">工商管理</option>
							<option value="行政会计">行政会计</option>
							<option value="信息管理">信息管理</option>
							<option value="软件工程">软件工程</option>
						</select>
					</td>
					<td></td>
				</tr>
				<tr>
					<td></td>
					<td>
						<input id="btn_submit" type="submit" onclick="javascript:return check();" value="提交"/>
						<input id="btn_reset" type="reset" value="重置"/>
					</td>
					<td></td>
				</tr>
			</tbody>	
		</table>
	</form>
</body>
<script type="text/javascript">
	function check() {
		var valid = true;
		
		var realName = document.getElementById("txt_realName");
		var studentNo = document.getElementById("txt_studentNo");
		
		if(realName == null || realName.value.length == 0) {
			document.getElementById("sp_realName").innerText = "请填写您姓名！";
			valid = false;
		} else {
			document.getElementById("sp_realName").innerText = "";
			console.log(realName.value);
		}
		
		if(studentNo == null || studentNo.value.length == 0) {
			document.getElementById("sp_studentNo").innerText = "请填写您学号！";
			valid = false;
		} else if (studentNo.value.length != 14) {
			document.getElementById("sp_studentNo").innerText = "请填写14位数的学号！";
			valid = false;
			//location.href = "error.html";
		} else {
			document.getElementById("sp_studentNo").innerText = "";
			console.log(studentNo.value);
		}
		
		return valid;
	}
</script>
</html>